<?php

function smarty_modifier_mascara_tel($string) {
  $qtd = strlen($string);
  if ($qtd == 8) {
    $n_tel = substr($string, 0, 4) . "-" . substr($string, 5, 8);
    return $n_tel;
  } elseif ($qtd == 10) {
    //$n_tel = substr($string, 0, 2) . "-" . substr($string,2, 4) . "-" . substr($string, 6, 10);
    $n_tel = "(" . substr($string, 0, 2) . ") " . substr($string,2, 4) . "-" . substr($string, 6, 10);
    return $n_tel;
  }
}

?>
